package com.wolf.etl.enumeration;

/**
 * @author sdyang
 * @create 2019-04-04 16:17
 **/
public enum DIALECT {
    UNKNOWN("0", "未知", "", ""),

    MYSQL("1", "MySql", "MysqlDialect", "select 1 from dual"),
    ORACLE("2", "Oracle", "OracleDialect", "select 1 from dual"),

    SQLSERVER("3", "SQL Server", "SqlServerDialect", "select 1"),
    SQLSERVER2005("4","SQL Server 2005","",""),

    POSTGRESQL("5", "PostgreSql", "PostgresqlDialect", "select version()"),

    DB2("6","DB2","Db2Dialect",""),
    H2("7","H2","H2Dialect",""),
    SQLITE("8","SQLite","SqliteDialect",""),
    MARIADB("9","MariaDB","MariadbDialect",""),

    REDIS("10","Redis","RedisDialect",""),
    MONGODB("11", "MongoDB", "MogodbDialect", ""),
    HBASE("12", "HBase", "HbaseDialect", ""),

    API("13", "API", "ApiDialect", ""),

    EXCEL("14", "Excel", "ExcelDialect", "");

    private String value;

    private String dialect;

    private String desc;

    private String className;

    private String validationQuery;

    public String getValidationQuery() {
        return validationQuery;
    }

    public void setValidationQuery(String validationQuery) {
        this.validationQuery = validationQuery;
    }

    DIALECT(String value, String desc, String className, String validationQuery) {
        this.value = value;
        this.desc = desc;
        this.className = className;
        this.validationQuery = validationQuery;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getDialect() {
        return dialect;
    }

    public void setDialect(String dialect) {
        this.dialect = dialect;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public boolean isEquals(String str) {
        if (this.value.equals(str)) {
            return true;
        }
        return false;
    }


    public static DIALECT value(String value) {
        switch (value) {
            case "1":
                return MYSQL;
            case "2":
                return ORACLE;
            case "3":
                return SQLSERVER;
            case "4":
                return POSTGRESQL;
            case "5":
                return MONGODB;
            case "6":
                return HBASE;
            default:
                return UNKNOWN;
        }
    }
}
